<template>
  <div class="homeswiper">
    <swiper ref="mySwiper" :options="swiperOptions" v-if="swiperList.length">
    <swiper-slide v-for="item of swiperList" :key="item.id">
      <img class="swiper-img" :src="item.imgUrl">
    </swiper-slide>
    <div class="swiper-pagination" slot="pagination"></div>
  </swiper>
  </div>
</template>

<script>
export default {
  name: 'HomeSwiper',
  props:{
    swiperList:Array
  },
  data() {
      return {
        swiperOptions: {
          pagination: '.swiper-pagination',
          loop:true,
          autoplay:3000,
        }
      }
    },
}
</script>

<style lang="stylus" scoped>
// 穿透
.homeswiper >>> .swiper-pagination-bullet-active
    background #fff
.homeswiper
    width 100%
    overflow hidden
    height 0
    // 其中50%为轮播图片的宽高比
    padding-bottom 40%
    // 用于图片没有加载出来时的背景显示
    background #eee   
    // border-top 1px solid #999
    // border-bottom 1px solid #999
.swiper-img
    width 100%
.swiper-pagination
    padding-bottom 10%
</style>